package arbori;

import visitor.Visitor;
import arbori.Nod;
/**
 * 
 * @author Bondar Ferenc
 * @version 1.0
 *
 */
/**
 * All the attributes are in protected type.<br />
 * This class is the implementation of the node concept. <br />
 * See <A href="https://sites.google.com/site/sabloanedeproiectare/refactoring" > Design Patterns Lab </A>
 */
public abstract class Nod {
	protected Nod fStang;
	protected Nod fDrept;
	protected double x;
	/**
	 * Gets the left descendant
	 * @return left descendant of the node
	 */
	public Nod getfStang() {
		return fStang;
	}
	/**
	 * Sets the left descendant
	 * @param fStang left descendant of the node
	 */
	public void setfStang(Nod fStang) {
		this.fStang = fStang;
	}
	/**
	 * gets the right descendant
	 * @return right descendant of the node
	 */
	public Nod getfDrept() {
		return fDrept;
	}
	/**
	 * sets the right descendant
	 * @param fDrept right descendant of the node
	 */
	public void setfDrept(Nod fDrept) {
		this.fDrept = fDrept;
	}
	/**
	 * 
	 * @return the value of the node
	 */
	public double getX() {
		return x;
	}
	/**
	 * sets the descendants to a value double x
	 * @param x the value of the descendants
	 */
	public void setX(double x) {
		this.x = x;
		if(fStang != null) fStang.setX(x);
		if(fDrept != null) fDrept.setX(x);
	}
	 public void acceptVisitor(Visitor v)
     {
             v.visit(this);
     }
     
	public abstract double calcul();
	public abstract String derivare();
	public abstract double calculDerivata();
	public abstract String toString();
}
